/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ecfdb;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author SIDALI
 */
@Entity
@Table(name = "legumes", catalog = "mandataire", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Legumes.findAll", query = "SELECT l FROM Legumes l"),
    @NamedQuery(name = "Legumes.findByIdlegumes", query = "SELECT l FROM Legumes l WHERE l.idlegumes = :idlegumes"),
    @NamedQuery(name = "Legumes.findByNom", query = "SELECT l FROM Legumes l WHERE l.nom = :nom"),
    @NamedQuery(name = "Legumes.findByImage", query = "SELECT l FROM Legumes l WHERE l.image = :image")})
public class Legumes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idlegumes", nullable = false)
    private Integer idlegumes;
    @Column(name = "nom", length = 45)
    private String nom;
    @Column(name = "image", length = 45)
    private String image;
    @OneToMany(mappedBy = "legumes")
    private List<LegumesDepot> legumesDepotList;
    @OneToMany(mappedBy = "idLegume")
    private List<Depot> depotList;

    public Legumes() {
    }

    public Legumes(Integer idlegumes) {
        this.idlegumes = idlegumes;
    }

    public Integer getIdlegumes() {
        return idlegumes;
    }

    public void setIdlegumes(Integer idlegumes) {
        this.idlegumes = idlegumes;
    }

    public String getNom() {
        return nom;
    }

    public void setNom(String nom) {
        this.nom = nom;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    @XmlTransient
    public List<LegumesDepot> getLegumesDepotList() {
        return legumesDepotList;
    }

    public void setLegumesDepotList(List<LegumesDepot> legumesDepotList) {
        this.legumesDepotList = legumesDepotList;
    }

    @XmlTransient
    public List<Depot> getDepotList() {
        return depotList;
    }

    public void setDepotList(List<Depot> depotList) {
        this.depotList = depotList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idlegumes != null ? idlegumes.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Legumes)) {
            return false;
        }
        Legumes other = (Legumes) object;
        if ((this.idlegumes == null && other.idlegumes != null) || (this.idlegumes != null && !this.idlegumes.equals(other.idlegumes))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return getNom();
    }
    
}
